package com.trade.data.type;

public enum IntervalTimeTypes {
	T3_SEC(1, "3SEC",3,"1d"),
	T2_MIN(2, "2MIN",120,"3d"),
	T2_MIN_3DAY(3, "2MIN",120,"3d"),
	T2_MIN_1DAY(4, "2MIN",120,"2m"), //Used for live prices
	T5_MIN(5, "5MIN",300,"5d"),
	T30_MIN(6,"30MIN",1800,"60d"),
	T30_MIN_1DAY(6,"30MIN",1800,"1d"), //Used for live prices
	TWEEK_DAY(7,"1WEEK",604800,"40Y"),
	T1_YEAR(8, "1YEAR",86400,"1Y"),
	T2_YEAR(9, "2YEAR",86400,"2Y"),
	T3_YEAR(10, "3YEAR",86400,"3Y"),
	T5_YEAR(11, "5YEAR",86400,"5Y"),
	T10_YEAR(12, "10YEAR",86400,"10Y");

	int id;
	String name;
	int periodValue;
	String period;


	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getPeriodValue(){
		return this.periodValue;
	}

	public String getPeriod(){
		return this.period;
	}


	IntervalTimeTypes(int id, String name , int periodValue, String period) {
		this.id = id;
		this.name = name;
		this.periodValue = periodValue;
		this.period = period;
	}

	//Type = "MIN","DAY","YEAR"
	public static IntervalTimeTypes getByValue(int value,String timeType) {
		for (IntervalTimeTypes type : IntervalTimeTypes.values()) {
			if (type.getId() == value && type.getName().contains(timeType)) {
				return type;
			}
		}
		return null;
	}




}